/* AT25DF SPI Flash public interface */

/* Copyright (C) 2011 David Zanetti
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; version 2 of the License.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#define AT25DF_H

/* prepare the chip to accept commands */
/* you must call spi_init() before calling this */
void at25df_init(void);

/* return the page size of the attached flash chip, for block programming */
uint16_t at25df_page_size(void);

/* write an arbitrary stream of bytes to the flash - VERY SLOW, since ignores pages */
uint8_t at25df_write_array(uint32_t address, uint16_t len, uint8_t *source);

/* read an arbitrary stream of bytes from the flash. Fast since it's streamed */
uint8_t at25df_read_array(uint32_t address, uint16_t len, uint8_t *target);
